package com.pvdnc.nsocket.server;

import com.pvdnc.nsocket.ManagedChannel;
import com.pvdnc.nsocket.protocol.base.Packet;

import io.netty.channel.Channel;

public abstract class ClientProxy {
    public ManagedChannel mChannel;

    public ClientProxy(Channel channel){
        mChannel=ManagedChannel.getInstance(channel);
    }

    public Channel getRawChannel(){
        return mChannel.getChannel();
    }

    boolean isSameChannel(Channel channel) {
        return mChannel.equals(ManagedChannel.getInstance(channel));
    }

    public <T extends Packet> void send(T packet,boolean needToWait){
        mChannel.send(packet,needToWait);
    }

    public abstract Packet onPreClose();

    public abstract void onPostClose();
}
